package com.jdls.tanhua.autoconfig;

import com.jdls.tanhua.properties.AipProperties;
import com.jdls.tanhua.properties.HuanXinProperties;
import com.jdls.tanhua.properties.OssProperties;
import com.jdls.tanhua.properties.SmsProperties;
import com.jdls.tanhua.template.AipTemplate;
import com.jdls.tanhua.template.HuanXinTemplate;
import com.jdls.tanhua.template.OssTemplate;
import com.jdls.tanhua.template.SmsTemplate;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;


//使Properties对象生效
@EnableConfigurationProperties({
        SmsProperties.class,
        OssProperties.class,
        AipProperties.class,
        HuanXinProperties.class
})
public class TanhuaAutoConfiguration {

    @Bean
    public SmsTemplate smsTemplate(SmsProperties properties) {
        return new SmsTemplate(properties);
    }

    @Bean
    public OssTemplate OssTemplate(OssProperties properties) {
        return new OssTemplate(properties);
    }

    @Bean
    public AipTemplate aipTemplate(){
        return new AipTemplate();
    }

    @Bean
    public HuanXinTemplate huanXinTemplate(HuanXinProperties huanXinProperties) {
        return new HuanXinTemplate(huanXinProperties);
    }

}